home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / s / copypagespecs.pprx < prev    next >
Text File  |  1992-03-14  |  2KB  |  101 lines

  1. /*
  2. @BCopyPageSpecs  @P@ICopyright Gold Disk Inc., February, 1992
  3. Copy page specification from the current page to a range of pages.
  4. */
  5.  
  6. address command
  7. call SafeEndEdit.rexx()
  8. cr     = '0a'x
  9. pageopts    = "OODDEEVENAALL"
  10. first = ppm_DocFirstPage()
  11. last  = ppm_DocLastPage()
  12. form = "Start Page:"first'0a'x "End Page:"last'0a'x "ODD/EVEN/ALL:"ALL
  13. form = upper(ppm_GetForm("Enter Info", 7, form))
  14. if form = '' then call exit_msg()
  15. parse var form startpage '0a'x endpage '0a'x pageopt
  16.  
  17. if ~(datatype(startpage, n) & datatype(endpage, n)) | pos(pageopt, pageopts) = 0
  18.     then exit_msg("Invalid input")
  19.  
  20. if startpage < first | startpage > last | endpage < first | endpage > last then
  21.     exit_msg('Invalid input')
  22.  
  23. if startpage > endpage then
  24. do
  25.     temp = startpage
  26.     startpage  = endpage
  27.     endpage = temp
  28. end
  29.  
  30. increment = 1
  31.  
  32. if pageopt = 'O' | pageopt = 'ODD' then
  33. do
  34.     if ~(startpage // 2) then startpage = startpage + 1
  35.     increment = 2
  36. end
  37. else if pageopt = 'E' | pageopt = 'EVEN' then
  38. do
  39.     if (startpage // 2) then startpage = startpage + 1
  40.     increment = 2
  41. end
  42.  
  43. call ppm_ShowStatus("Working...")
  44.  
  45. page         = ppm_CurrentPage()
  46. pagetype     = ppm_GetPageType(page)
  47. pagesize     = separate(ppm_GetPageSize(page))
  48. pagemargins  = separate(ppm_GetPageMargins(page))
  49. pagecolumns  = separate(ppm_GetPageColumns(page))
  50.  
  51. call ppm_AutoUpdate(0)
  52.  
  53. ps  = "call ppm_SetPageSize(page,"pagesize")"
  54. pm  = "call ppm_SetPageMargins(page,"pagemargins")"
  55. pc  = "call ppm_SetPageColumns(page,"pagecolumns")"
  56.  
  57. do page = startpage to endpage by increment
  58.  
  59.     call ppm_ShowStatus("Working on page "page"..")
  60.     call ppm_GotoPage(page)
  61.  
  62.     call ppm_SetPageType(page,  pagetype)
  63.     interpret ps
  64.     interpret pm
  65.     interpret pc
  66.  
  67. end
  68.  
  69. call exit_msg("Done")
  70.  
  71. exit_msg:
  72. do
  73.     parse arg message
  74.     call ppm_Inform(1, message,)
  75.     call ppm_ClearStatus()
  76.     call ppm_AutoUpdate(1)
  77.     exit
  78. end
  79.  
  80. separate:
  81. do
  82.     parse arg settings
  83.  
  84.     inpar   = ''
  85.  
  86.     do i = 1 to (words(settings) - 1)
  87.  
  88.        set   = word(settings, 1)
  89.  
  90.        inpar = inpar||set","
  91.        settings    = subword(settings,2)
  92.  
  93.     end
  94.  
  95.     inpar = inpar||settings
  96.  
  97.     return(inpar)
  98.  
  99. end
  100.  
  101.